<template>
  <div>
    <el-container>
      <el-main>
        <!-- 歌单介绍 -->
        <div class="m-info">
          <div class="left">
            <img v-lazy="programDetail.blurCoverUrl">
            <span></span>
          </div>
          <div class="right">
            <div class="hd flex">
              <i class="iconfont icon-biaoqian"></i>
              <h2 class="tit">{{programDetail.name}}</h2>
            </div>
            <div class="user flex">
              <a
                href="javascript:;"
                class="bgname"
                @click.prevent="goRadio(programDetail.radio.id)"
              ><i class="iconfont icon-yinfu"></i>{{programDetail.radio.name}}</a>
              <a
                href="#"
                class="read"
              ><i class="iconfont icon-xingxing"></i>订阅({{programDetail.radio.subCount}})</a>
            </div>

          </div>
        </div>
        <div class="btns">
          <a
            href="#"
            class="bo"
          ><i class="iconfont icon-bofang">播放{{programDetail.duration | dateFormat2}}</i></a>
          <a href="#"><i class="iconfont icon-zan"></i>（{{programDetail.likedCount}}）</a>
          <a href="#"><i class="iconfont icon-pinglun"></i>（{{programDetail.commentCount}}）</a>
          <a href="#"><i class="iconfont icon-fenxiang"></i>（{{programDetail.shareCount}}）</a>
          <a href="#"><i class="iconfont icon-xiazai1"></i>下载</a>
          <a
            href="#"
            class="wailink"
          ><i class="iconfont icon-yinle"></i>生成外链播放器</a>
        </div>
        <div class="sub">
          <a
            href="#"
            class="cart"
          >{{programDetail.categoryName}}</a>
          <strong class="strong">
            <span class="f-thide">{{programDetail.radio.name}}</span>第{{programDetail.serialNum}}期
          </strong>
          <span class="time">{{programDetail.createTime | dateFormat}} 创建</span>
          <span class="sep">播放：<em>{{programDetail.listenerCount}}</em>次</span>
        </div>
        <p class="intr" v-html="programDetail.description">介绍：
          <!-- <pre>{{programDetail.description}}</pre> 中只有检测到\n才换行，导致内容超出-->
        </p>
        <!-- END------------------------------ -->
        <!-- 评论区 -->
        <commo :pid="plid"></commo>
        <!-- END------------------------------ -->
      </el-main>
      <el-aside width="270px">
        <p class="famil">更多节目</p>
        <ul class="hotots">
          <li
            v-for="(item,index4) in hotlist"
            :key="index4"
            class="flex"
          >
            <div class="left">
              <img v-lazy="item.coverImgUrl">
            </div>
            <div class="right">
              <p class="fir f-thide"><a
                  href="#"
                  @click.prevent="gopldetail(item.id)"
                >{{item.name}}</a></p>
              <p class="sec f-thide">by<a href="#">{{item.userId}}</a></p>
            </div>
          </li>
        </ul>
        <div class="moreInsl">
          <p class="duoduan">网易云音乐多端下载</p>
          <ul>
            <li class="fir">
              <a href="#">
                <i class="iconfont icon-anzhuoshouji"></i>
              </a>
            </li>
            <li class="sec">
              <a href="#">
                <i class="iconfont icon-windows"></i>
              </a>
            </li>
            <li class="thr">
              <a href="#">
                <i class="iconfont icon-pingguoshouji"></i>
              </a>
            </li>
          </ul>
          <p class="last">同步歌单，随时畅听320k好音乐</p>
        </div>
      </el-aside>
    </el-container>
  </div>

</template>

<script>
import axios from 'axios'
import commo from '../comment/djcomment'
import bus from '../../eventbus'
export default {
  components: { commo },
  data () {
    return {
      plid: 0,
      programDetail: [
        {
          dj: {
            avatarUrl: '',
            nickname: ''
          },
          tracks: '',
          playCount: 0,
          trackCount: 0,
          description: ''
        }
      ],
      TVlist: [],
      // 热门歌单
      hotlist: [],
      // 排序方式
      asc: false
    }
  },
  created () {
    this.getplDetail()
  },
  watch: {
    // plid (newVal, oldVal) {
    //   console.log(newVal, oldVal)
    //   this.getplDetail()
    // }
  },
  methods: {
    // 获取歌单内容
    async getplDetail () {
      this.plid = this.$route.query.id
      let res = await axios.get('https://autumnfish.cn//dj/program/detail?id=' + this.plid)
      // console.log(res)
      this.programDetail = res.data.program
      this.programDetail.description = res.data.program.description.replace(/\n/g, '<br>')
    },
    goRadio (id) {
      this.$router.push({ path: '/djradio', query: { id: id } })
    },
    // 点击播放按钮
    async playDJ (id) {
      bus.$emit('musicid', id)
    },
    goUserHome (id) {
      this.$router.push({ path: '/user', query: { id: id } })
    },
    // 点击节目，跳转至节目页
    goDJ (id) {
      // this.$router.push({ path: '/song', query: { id: id } })
    },
    // 点击作者，跳转至个人页
    goArtist (id) {
      this.$router.push({ path: '/artist', query: { id: id } })
    },
    // 点击专辑名，跳转至专辑
    goAlbum (id) {
      this.$router.push({ path: '/discover/album', query: { id: id } })
    },
    gopldetail (id) {
      this.$router.push({ path: '/playlist', query: { id: id } })
      // ------------------待优化。自己跳自己
      this.getplDetail()
    },
    // 点击播放按钮，播放音乐
    playMusic (id) {
      bus.$emit('musicid', id)
    },
    updateChec (i) {
      if (i === 1) {
        this.asc = false
      }
      else {
        this.asc = true
      }
      this.getplDetail()
    }
  }
}
</script>

<style lang="less" scoped>
.el-container {
  width: 980px;
  min-height: 700px;
  _height: 700px;
  margin: 0 auto;
  background-color: #fff;
  border: 1px solid #d3d3d3;
  border-width: 0 1px;
  .el-main {
    padding: 47px 30px 40px 39px !important;
    // 歌单介绍
    .m-info {
      position: relative;
      .left {
        width: 140px;
        height: 140px;
        position: absolute;
        left: 0;
        top: 0;
        img {
          width: 100%;
          height: 100%;
        }
        span {
          width: 146px;
          height: 146px;
          background-image: url(../../assets/image/coverall.png);
          background-position: 0 -1285px;
          position: absolute;
          top: -4px;
          left: -4px;
        }
      }
      .right {
        margin-left: 160px;
        .hd {
          margin: 0 0 12px;
          line-height: 24px;
          .iconfont {
            color: #da1e1e;
            font-size: 20px;
          }

          .tit {
            font-weight: normal;
            font-size: 20px;
            margin-left: 10px;
          }
        }
        .user {
          margin: 0 0 20px;
          line-height: 35px;
          .bgname {
            font-size: 16px;
            color: #666;
          }
          .bgname:hover {
            text-decoration: underline;
          }
          .read {
            display: inline-block;
            font-size: 13px;
            margin-left: 17px;
            color: #333;
            border: 1px solid #999;
            padding: 5px;
            border-radius: 3px;
            height: 18px;
            line-height: 18px;
            .iconfont {
              margin-right: 5px;
            }
          }
          .read:hover {
            background: #f7f6f6;
          }
        }
      }
    }
    .btns {
      margin-top: 65px;
      margin-bottom: 25px;
      a {
        color: #333;
        display: inline-block;
        margin-right: 10px;
        padding: 0 5px;
        height: 31px;
        line-height: 30px;
        min-width: 23px;
        border: 1px solid #f2f2f2;
        background-color: #f2f2f2;
        border-radius: 5px;
        font-size: 12px;
        text-align: center;
        .iconfont {
          font-size: 13px;
          margin-right: 5px;
        }
      }
      .bo {
        color: #fff;
        background-color: #4190d9;
        border: none;
        border-radius: 5px 0 0 5px;
        border-right: 1px solid #666;
      }
      .wailink {
        color: #0c73c2;
        cursor: pointer;
      }
    }
    .sub {
      height: 35px;
      line-height: 35px;
      .cart {
        color: #cc0000;
        border: 1px solid #000;
        border-color: #cc0000;
        padding: 0 6px;
        font-size: 13px;
        margin-right: 10px;
      }
      .strong {
        font-size: 14px;
        span {
          padding-bottom: 2px;
          max-width: 42%;
          margin-right: 5px;
        }
      }
      .time {
        font-size: 12px;
        margin-left: 18px;
        color: #999;
      }
      .sep {
        font-size: 12px;
        margin-left: 18px;
        color: #999;
        em {
          color: #c20c0c;
          font-weight: bold;
        }
      }
    }
    .intr {
      margin-top: 4px;
      line-height: 23px;
      color: #666;
      font-size: 12px;
      width: 640px;
    }
    // 评论
    .n-cmt {
      .commo {
        margin-top: 40px;
        .comtit {
          height: 33px;
          border-bottom: 2px solid #c20c0c;
          display: flex;
          justify-content: left;
          align-items: center;
          h3 {
            font-size: 20px;
            font-weight: normal;
          }
          span {
            margin-left: 20px;
            color: #666;
            font-size: 12px;
          }
        }
        .commain {
          // 评论输入框
          .iptarea {
            margin-bottom: 20px;
            display: flex;
            justify-content: left;
            align-items: center;
            margin-top: 20px;
            .head {
              width: 50px;
              height: 50px;
              margin-right: 20px;
              margin-bottom: 35px;
              img {
                width: 100%;
                height: 100%;
              }
            }
            .hflag {
              .shuqu {
                padding-right: 14px;
                textarea {
                  height: 50px;
                  display: block;
                  padding: 5px 6px 6px;
                  border: 1px solid #cdcdcd;
                  border-radius: 2px;
                  line-height: 19px;
                  box-sizing: content-box;
                  resize: none;
                  overflow: auto;
                  font-size: 12px;
                  color: #333;
                }
              }
              .combtns {
                padding: 0 10px;
                padding-top: 10px;
                .iconfont {
                  float: left;
                  margin: 0px 10px 0 0;
                  cursor: pointer;
                }
                a {
                  float: right;
                  font-size: 12px;
                  display: inline-block;
                  width: 46px;
                  height: 25px;
                  color: #fff;
                  background-color: #4391da;
                  text-align: center;
                  line-height: 25px;
                }
              }
            }
          }
          // 评论区
          .cmmts {
            position: relative;
            overflow: hidden;
            h3 {
              height: 20px;
              border-bottom: 1px solid #cfcfcf;
              font-weight: normal;
              font-size: 14px;
            }
            .acom {
              // height: 70px;
              // position: relative;
              padding: 15px 0;
              border-top: 1px solid #ccc;
              display: flex;
              justify-content: left;
              // align-items: center;
              .head {
                width: 50px;
                height: 50px;
                margin-right: 10px;
                img {
                  width: 100%;
                  height: 100%;
                }
              }
              .cntwrap {
                width: 100%;
                .usersay {
                  width: 100%;
                  overflow: hidden;
                  line-height: 20px;
                  font-size: 12px;
                  color: #333;
                  a {
                    font-size: 12px;
                    margin-right: 5px;
                    color: #0c73c2;
                  }
                  a:hover {
                    text-decoration: underline;
                  }
                  img {
                    height: 12px;
                    margin-right: 5px;
                  }
                }
                .myact {
                  margin-top: 15px;
                  text-align: right;
                  .time {
                    font-size: 12px;
                    float: left;
                    margin: 0 !important;
                    color: #999;
                  }
                  a {
                    font-size: 12px;
                    color: #999;
                  }
                  span {
                    margin: 0 8px;
                    color: #ccc;
                  }
                  .iconfont {
                    margin-right: 5px;
                    vertical-align: -2px;
                    font-size: 12px;
                    color: skyblue;
                  }
                }
              }
            }
            .hui {
              position: absolute;
              left: 0px;
              top: 0px;
              display: none;
              margin-left: 60px;
              margin-bottom: 15px;
              border: 1px solid #d9d9d9;
              border-radius: 2px;
              .iner {
                padding: 15px;
                background: #f8f8f8;
                border: 1px solid #fcfcfc;
                border-radius: 2px;
                .u-txtwrap {
                  padding-right: 14px;
                  .txthui {
                    margin: 0;
                    padding: 5px 6px 6px;
                    border: 1px solid #cdcdcd;
                    border-radius: 2px;
                    line-height: 19px;
                    box-sizing: content-box;
                    height: 20px;
                  }
                }
                .combtnss {
                  width: 530px;
                  height: 22px;
                  padding-top: 10px;
                  .iconfont {
                    float: left;
                    margin: 0px 10px 0 0;
                    cursor: pointer;
                    font-size: 20px;
                  }
                  .huifu {
                    display: inline-block;
                    width: 46px;
                    height: 25px;
                    float: right;
                    background-color: #3282ce;
                    color: #fff;
                    text-align: center;
                    line-height: 25px;
                    font-size: 12px;
                  }
                  .xz {
                    font-size: 12px;
                    float: right;
                    margin-right: 10px;
                    line-height: 25px;
                    color: #999;
                  }
                }
              }
            }
          }
          // 页数
          .j-flag {
          }
        }
      }
    }
  }
  .el-aside {
    padding: 20px 40px 40px 30px;
    .famil {
      height: 23px;
      margin-bottom: 20px;
      border-bottom: 1px solid #ccc;
      color: #333;
      font-size: 14px;
    }
    .hotots {
      margin-bottom: 25px;
      font-size: 12px;
      color: #333;
      li {
        width: 200px;
        height: 50px;
        margin-bottom: 15px;
        line-height: 24px;
        .left {
          width: 50px;
          height: 50px;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .right {
          margin-left: 10px;
          p {
            width: 140px;
          }
          .fir {
            a {
              font-size: 14px;
              color: #000;
            }
          }
          .sec {
            color: #999;
            font-size: 12px;
            a {
              color: #333;
              font-size: 12px;
              margin: 0 2px 0 4px;
            }
          }
        }
      }
    }
    .moreInsl {
      margin: 20px 0;
      padding-bottom: 20px;
      .duoduan {
        height: 23px;
        margin-bottom: 20px;
        border-bottom: 1px solid #ccc;
        color: #333;
        font-size: 12px;
        font-weight: 600;
      }
      ul {
        margin-bottom: 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        li {
          a {
            .iconfont {
              font-size: 45px;
              color: #c2c2c2;
            }
          }
        }
        .fir {
          a {
            width: 42px;
            height: 48px;
          }
        }
        .sec {
          width: 60px;
          height: 48px;
          margin: 0 26px 0 30px;
        }
        .thr {
          width: 42px;
          height: 48px;
        }
      }
      .last {
        font-size: 12px;
        color: #999;
      }
    }
  }
}
</style>
